﻿using System;
using System.Windows.Forms;

namespace MobileCommissionManagement.Controls
{
    public partial class Login : Form
    {
        private Controller _controller;

        #region Properties

        public Controller Controller
        {
            set { _controller = value; }
        }

        #endregion

        public Login()
        {
            InitializeComponent();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            if (!_controller.Logon(userTextBox.Text, passwordTextBox.Text))
            {
                MessageBox.Show("Utilizador ou senha inválidos."+ Environment.NewLine + " Por favor, verifique e tente de novo.", 
                    "Entrar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DialogResult = DialogResult.None;
            }
        }
    }
}
